package demo1;

import demo1.Sort;

import java.util.*;
public class Test {
/*    public static void timeQuick2(int[] elem){
        demo1.Sort sort = new demo1.Sort();
        int[] array = Arrays.copyOf(elem, elem.length);
        long startTime = System.currentTimeMillis();
        sort.quickSort2(array);
        long endTime = System.currentTimeMillis();
        System.out.println("快速排序用时:" + (endTime - startTime));
    }*/
    public static void timeQuick(int[] elem){
        Sort sort = new Sort();
        int[] array = Arrays.copyOf(elem, elem.length);
        long startTime = System.currentTimeMillis();
        sort.quickSort(array);
        long endTime = System.currentTimeMillis();
        System.out.println("经优化后的快速排序用时:" + (endTime - startTime));
    }
    public static void main(String[] args){
        Random random = new Random();
        int[] array = new int[100_0000];
        for(int i = 0; i < array.length; i++){
            array[i] = i;
        }
        timeQuick(array);
        /*int[] array2 = {8,9,8,6,1,5,7,9,6,6,7,1,6,4,5,2};
        demo1.Sort sort = new demo1.Sort();
        sort.quickSort(array2);
        System.out.println(Arrays.toString(array2));*/
    }

}
